package fiuba.algo3.algoThieft.vista;

import java.awt.Button;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

@SuppressWarnings("serial")
public class DialogSiNo extends Dialog implements ActionListener {

	
	private Button BotonSi = new Button("Si");
	private Button BotonNo = new Button("No");
	
	public DialogSiNo(Frame owner, String title, String pregunta, ActionListener listener) {
		
		super(owner, pregunta , true);
		
		
		this.setTitle(title);
		
		setLayout(new GridLayout(0, 1));
		setSize( 220, 110); 
		setResizable(false);

		new CentralizadorDeVentana().centrarVentana(this);

		
		Label lblMsg = new Label(pregunta);
		lblMsg.setAlignment(Label.CENTER);
		this.add( "Center" , lblMsg);
		Panel panelBotones = new Panel();
		panelBotones.add(BotonSi);
		panelBotones.add(BotonNo);
		this.add( "South" , panelBotones);
		
		this.BotonSi.addActionListener(listener);
		this.BotonNo.addActionListener(listener);
		this.BotonSi.addActionListener(this);
		this.BotonNo.addActionListener(this);
		this.setVisible(true);
		
		
	}
	
	public static class CloseListener extends WindowAdapter	
	{	public void windowClosing(WindowEvent e)
	{	
		e.getWindow().dispose();
	}
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		this.dispose();
		
	}

}
